The return value has not been clearly defined, with the function
never returning 0 which seemingly indicated a condition where the
guest should crash.
In this patch we define -rc as error condition where a subscriber is
present but an error prevented the notification from being sent;
0 where there is no subscriber or the notification was sent and the vCPU
is not paused (i.e. safe to continue execution as normal); and 1 where the
notification was sent with the vCPU paused and we are waiting for a
response.
Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
.u.write_ctrlreg.old_value = old
};
- vm_event_monitor_traps(curr, sync, &req);
- return 1;
+ if ( vm_event_monitor_traps(curr, sync, &req) >= 0 )
+ return 1;
}
return 0;
break;
}
else {
- int handled =
+ int rc =
hvm_monitor_breakpoint(regs->eip,
HVM_MONITOR_SOFTWARE_BREAKPOINT);
- if ( handled < 0 )
+ if ( !rc )
{
struct hvm_trap trap = {
.vector = TRAP_int3,
hvm_inject_trap(&trap);
break;
}
- else if ( handled )
+ if ( rc > 0 )
break;
}
* If there was no ring to handle the event, then
* simply continue executing normally.
*/
- return 1;
+ return 0;
default:
return rc;
};
{
req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
vm_event_vcpu_pause(v);
+ rc = 1;
}
if ( altp2m_active(d) )
vm_event_fill_regs(req);
vm_event_put_request(d, &d->vm_event->monitor, req);
- return 1;
+ return rc;
}
/*